package study.cell_game.objects.textures;

import org.andengine.engine.Engine;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.andengine.opengl.texture.region.TextureRegion;
import org.andengine.ui.activity.BaseGameActivity;

public class CommonTextures {
	private BitmapTextureAtlas textureAtlas;
	private TextureRegion backgroundGradientTextureRegion;
	private TextureRegion backgroundCircuitTextureRegion;
	
	public CommonTextures(final BaseGameActivity activity, final Engine engine) {
	    //create atlas
		this.textureAtlas = new BitmapTextureAtlas(engine.getTextureManager(), 2048, 2048,
	        TextureOptions.BILINEAR_PREMULTIPLYALPHA);
		
		//add textures to it.
		this.backgroundCircuitTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
		        this.textureAtlas, activity, "gfx/background.png", 0, 0);
		 this.backgroundGradientTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
			        this.textureAtlas, activity, "gfx/LevelRedBlueGradient.png", 0, 720);   
		 
		 engine.getTextureManager().loadTexture(textureAtlas);
	}

	public TextureRegion getBackgroundGradientTextureRegion() {
		return backgroundGradientTextureRegion;
	}

	public TextureRegion getBackgroundCircuitTextureRegion() {
		return backgroundCircuitTextureRegion;
	}	
	
}
